{% macro render_pagination(pagination, endpoint, form=None) %}
    {% if pagination.pages > 1 %}
        <div class="pagination-container">
            <div class="pagination-info">
                共 {{ pagination.total }} 条记录
            </div>
            <div class="pagination-controls">
                {% if pagination.has_prev %}
                    <a href="{{ url_for(endpoint, page=pagination.prev_num, **form.data) }}" class="pagination-btn prev-btn">
                        <i class="fa fa-angle-left"></i>
                    </a>
                {% endif %}
                {% for page in pagination.iter_pages() %}
                    {% if page %}
                        {% if page != pagination.page %}
                            <a href="{{ url_for(endpoint, page=page, **form.data) }}" class="pagination-btn">{{ page }}</a>
                        {% else %}
                            <span class="pagination-btn active">{{ page }}</span>
                        {% endif %}
                    {% endif %}
                {% endfor %}
                {% if pagination.has_next %}
                    <a href="{{ url_for(endpoint, page=pagination.next_num, **form.data) }}" class="pagination-btn next-btn">
                        <i class="fa fa-angle-right"></i>
                    </a>
                {% endif %}
            </div>
        </div>
    {% endif %}
{% endmacro %}